#include "Application.h"
#include <boost/shared_ptr.hpp>
#include <windows.h>

boost::shared_ptr<Broady::Application> g_App;

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
	// Enable CRT debugging functions
	int dbgFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
	dbgFlag |= _CRTDBG_LEAK_CHECK_DF;
	_CrtSetDbgFlag( dbgFlag );

	g_App = boost::shared_ptr<Broady::Application>( new Broady::Application( ) );

	if( !g_App )
	{
		return -1;
	}

	if( !g_App->Init( ) )
	{
		return 1;
	}

	g_App->DoLoop( );
	g_App->Quit( );

	return 0;
}
